package com.zret.oasys.operation.emp;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.google.gson.Gson;
import com.zret.oasys.entity.Emp;

public class GetEmpName implements EmpServletOperation {

	@Override
	public void doOperation(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		// 1.设置json编码
		response.setContentType("application/json;charset=utf-8");
		int empid = Integer.parseInt(request.getParameter("empid"));
		List<Emp> list = empService.getEmpManager(empid); 
		// 输出流
		PrintWriter out = response.getWriter();
		Gson gson = new Gson();
		String jsonString = gson.toJson(list.get(0));
		System.out.println(jsonString);
		out.print(jsonString);
		out.close();

	}

}
